import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddUniqueConstraintToProjectName1724356272000 implements MigrationInterface {
    name = 'AddUniqueConstraintToProjectName1724356272000';

    public async up(queryRunner: QueryRunner): Promise<void> {
        // Add unique constraint to project name column
        await queryRunner.query(`ALTER TABLE \`project\` ADD UNIQUE INDEX \`IDX_project_name\` (\`name\`)`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        // Remove unique constraint from project name column
        await queryRunner.query(`ALTER TABLE \`project\` DROP INDEX \`IDX_project_name\``);
    }
}